package com.china08.yxyapi.api.manage.stu.mystudy.tifenbao.scoreimprove;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.china08.yxyapi.api.YxyApiBaseController;
import com.china08.yxyapi.model.YxyApiReqModel;
import com.china08.yxyapi.model.YxyApiRespModel;
import com.china08.yxyapi.service.tifenbao.TifenbaoPlanUpdService;

import io.swagger.annotations.ApiOperation;

/**
 * 首页--计划列表--已截止计划--确认分数
 */
@CrossOrigin
@RestController
public class TifenbaoPlanUpdController extends YxyApiBaseController {
    @Autowired
    private TifenbaoPlanUpdService tifenbaoPlanUpdService;

    @ApiOperation(value = "首页--计划列表--已截止计划--确认分数")
    @ResponseBody
    @RequestMapping(value = "/api_yw/manage/stu/mystudy/tifenbao/scoreimprove/upd", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public RespModel precess(HttpServletRequest request, HttpServletResponse response, @RequestBody ReqModel reqModel) {

        RespModel respModel = new RespModel();
        Integer result = tifenbaoPlanUpdService.updatePlan(reqModel.id, reqModel.currentScore);
        respModel.result = result;
        return respModel;
    }

    protected static class ReqModel extends YxyApiReqModel {

        public String id;// 计划id

        public Double currentScore;// 本次考试成绩

    }

    protected static class RespModel extends YxyApiRespModel {

        public Integer result;// 结果1成功0失败

    }

}
